<?php

namespace Biz\service\brand;

/**
 * 品牌收费订单生成
 *
 * @category   Module name
 * @package    PSR
 * @subpackage Documentation\API
 * @author     zhouyang  <zhouyang@haohaozhu.com>
 * @license    GPL http://www.haohaozhu.com
 * @link       http://www.haohaozhu.com
 */

class OrderSN
{
    /**
     * 生成品牌订单号
     * 10023459994321
     * 3位预留+时间戳后4位+3位随机+uid后四位
     * @param $uid
     * @return string
     */
    public static function createOrderSN($uid)
    {
        $reserved = '100';

        $uid_tail = substr($uid, -4);

        $rand = sprintf("%04d", mt_rand(0, 999));

        $time_tail = substr(time(), -4);

        return $reserved . $time_tail . $rand . $uid_tail;
    }
}
